home *** CD-ROM | disk | FTP | other *** search
/ Interactive CD-ROM & Web Magazine 6 / Interactive CD-ROM & Web Magazine 6.iso / pc / imm / db / db.dir / 00017.ls < prev    next >
Encoding:
Text File  |  1996-04-05  |  7.9 KB  |  297 lines

  1. global Obj, dbsectionnum, sectionname, fileName, content, linestart, workingdb, rosso, giallo, verde, lastmc, hotcast, db, currentNetHandler, curSubSection, curLine
  2.  
  3. on startMovie
  4.   preLoad(frame, 2, 10)
  5.   preLoad(cast 194, 195, 196, 197)
  6.   set lastmc to -1
  7.   set hotcast to [190, 191, 192, 193, 194, 195, 196, 197, 177, 207, 208, 209, 210]
  8.   resetsprites()
  9.   resetsprites2()
  10.   set content to EMPTY
  11.   repeat with a = 26 to 29
  12.     puppetSprite(a, 1)
  13.   end repeat
  14.   initcolors()
  15.   settastili(3, 8)
  16.   bootstrap()
  17.   initDB()
  18. end
  19.  
  20. on initDB
  21.   put " " into field (1000 + workingdb)
  22.   put " " into field (1100 + workingdb)
  23.   settastili(3, 8)
  24.   processdb(line workingdb of fileName, workingdb)
  25.   showsubsection(workingdb)
  26. end
  27.  
  28. on games
  29.   set workingdb to 1
  30.   initDB()
  31. end
  32.  
  33. on Internet
  34.   set workingdb to 2
  35.   initDB()
  36. end
  37.  
  38. on GIFTS
  39.   set workingdb to 3
  40.   initDB()
  41. end
  42.  
  43. on CDrom
  44.   set workingdb to 4
  45.   initDB()
  46. end
  47.  
  48. on stopMovie
  49.   clearall()
  50. end
  51.  
  52. on clearall
  53.   settastili(3, 8)
  54.   put " " into field 1001
  55.   put " " into field 1002
  56.   put " " into field 1003
  57.   put " " into field 1004
  58.   put " " into field 1101
  59.   put " " into field 1102
  60.   put " " into field 1103
  61.   put " " into field 1104
  62. end
  63.  
  64. on showsubsection dbindex
  65.   set the text of field "sottosezione" to the text of field (1000 + dbindex)
  66. end
  67.  
  68. on checkclickedline
  69.   set linea to the mouseLine
  70.   cursor(4)
  71.   if linea > 0 then
  72.     set the foreColor of field "sottosezione" to giallo
  73.     set the foreColor of line linea of field "sottosezione" to verde
  74.     resetsprites()
  75.     resetsprites2()
  76.     if workingdb = 2 then
  77.       set curSubSection to linea
  78.       set tempnome to EMPTY
  79.       set tempField to the text of field (500 + linea)
  80.       repeat with N = 1 to the number of lines in tempField
  81.         put item 1 of line N of tempField & RETURN after tempnome
  82.         put tempnome into field "nome"
  83.       end repeat
  84.       cursor(-1)
  85.       return 
  86.     end if
  87.     if workingdb = 4 then
  88.       set curSubSection to linea
  89.       set tempnome to EMPTY
  90.       set tempField to the text of field (511 + linea)
  91.       repeat with N = 1 to the number of lines in tempField
  92.         put item 2 of line N of tempField & RETURN after tempnome
  93.         put tempnome into field "nome"
  94.       end repeat
  95.       cursor(-1)
  96.       return 
  97.     end if
  98.     set linestart to value(line linea of field (1100 + workingdb))
  99.     if linea <> the number of lines in field "sottosezione" then
  100.       set linestop to value(line linea + 1 of field (1100 + workingdb)) - 1
  101.     else
  102.       set linestop to the number of lines in content
  103.     end if
  104.     settastili(4, 8)
  105.     set tempnome to EMPTY
  106.     put "linestart" && linestart
  107.     put "linestop" && linestop
  108.     repeat with N = linestart to linestop
  109.       put item 2 of line N of content & RETURN after tempnome
  110.       put tempnome into field "nome"
  111.     end repeat
  112.   end if
  113.   cursor(-1)
  114. end
  115.  
  116. on checkclickedlinenome
  117.   set linea to the mouseLine
  118.   if linea > 0 then
  119.     resetsprites2()
  120.     resetsprites()
  121.     set selection to linea
  122.     set the foreColor of field "nome" to giallo
  123.     set the foreColor of line linea of field "nome" to verde
  124.     if workingdb = 2 then
  125.       set curField to the text of field (500 + curSubSection)
  126.       set the text of field "tecnico" to item 3 of line linea of curField
  127.       set the text of field "testo" to item 2 of line linea of curField
  128.       set the text of field "path" to item 5 of line linea of curField
  129.       set the text of field "URL" to item 4 of line linea of curField
  130.       set votazzo to char 1 of item 7 of line linea of curField
  131.     else
  132.       if workingdb = 4 then
  133.         set curField to the text of field (511 + curSubSection)
  134.         set the text of field "tecnico" to item 4 of line linea of curField
  135.         set the text of field "testo" to item 3 of line linea of curField
  136.         set the text of field "path" to item 6 of line linea of curField
  137.         set the text of field "URL" to item 5 of line linea of curField
  138.         set votazzo to char 1 of item 8 of line linea of curField
  139.       else
  140.         set the text of field "tecnico" to item 4 of line linea + linestart - 1 of content
  141.         set the text of field "testo" to item 3 of line linea + linestart - 1 of content
  142.         set the text of field "path" to FullPath(item 6 of line linea + linestart - 1 of content)
  143.         set the text of field "URL" to item 5 of line linea + linestart - 1 of content
  144.         set votazzo to char 1 of item 8 of line linea + linestart - 1 of content
  145.         set curLine to linea
  146.       end if
  147.     end if
  148.     if workingdb = 3 then
  149.       set curGiftOS to item 7 of line curLine + linestart - 1 of content
  150.       if Installable(curGiftOS) then
  151.         set the visible of sprite 7 to 1
  152.         set the visible of sprite 8 to 1
  153.         set the visible of sprite 9 to 1
  154.       end if
  155.     end if
  156.     put votazzo
  157.     if value(votazzo) > 4 then
  158.       set the visible of sprite 16 to 1
  159.     end if
  160.     set the visible of sprite (10 + value(votazzo)) to 1
  161.   end if
  162. end
  163.  
  164. on resetsprites2
  165.   repeat with a = 7 to 9
  166.     set the visible of sprite a to 0
  167.   end repeat
  168. end
  169.  
  170. on resetsprites
  171.   repeat with a = 11 to 16
  172.     set the visible of sprite a to 0
  173.   end repeat
  174. end
  175.  
  176. on initcolors
  177.   set blu to the foreColor of field "blu"
  178.   set giallo to the foreColor of field "giallo"
  179. end
  180.  
  181. on bootstrap
  182.   set sectionname to EMPTY
  183.   set fileName to EMPTY
  184.   set the itemDelimiter to TAB
  185.   set Obj to FileIO(mnew, "read", the pathName & "config.db")
  186.   if not objectp(Obj) then
  187.     alert("no oggetto" & Obj)
  188.   end if
  189.   set content to Obj(mReadFile)
  190.   put Obj(mdispose)
  191.   set dbsectionnum to the number of lines in content
  192.   repeat with N = 1 to dbsectionnum
  193.     put item 1 of line N of content after line N of sectionname
  194.     put item 2 of line N of content after line N of fileName
  195.   end repeat
  196. end
  197.  
  198. on processdb dbase, dbindex
  199.   if dbindex = 2 then
  200.     set the text of cast 1002 to the text of cast 500
  201.     return 
  202.   end if
  203.   if dbindex = 4 then
  204.     set the text of cast 1004 to the text of cast 535
  205.     return 
  206.   else
  207.     if dbindex = 3 then
  208.       set content to the text of field "gift"
  209.     else
  210.       if dbindex = 1 then
  211.         set content to the text of field "dbgames"
  212.       end if
  213.     end if
  214.   end if
  215.   set numlines to the number of lines in content
  216.   set old to EMPTY
  217.   set a to 1
  218.   repeat with N = 1 to numlines
  219.     set new to item 1 of line N of content
  220.     if new <> old then
  221.       put new after line a of field (1000 + dbindex)
  222.       put N after line a of field (1100 + dbindex)
  223.       set a to a + 1
  224.       set old to new
  225.     end if
  226.   end repeat
  227. end
  228.  
  229. on settastili x, y
  230.   repeat with N = x to y
  231.     set the text of field N to " "
  232.     set the textFont of field N to "monaco"
  233.     set the textSize of field N to 10
  234.     set the textStyle of field N to "plain"
  235.     if the foreColor of field N <> giallo then
  236.       set the foreColor of field N to giallo
  237.     end if
  238.   end repeat
  239. end
  240.  
  241. on suoppatasto spriteNum, castDown, handler
  242.   set flegghino to 0
  243.   set SaveCast to the castNum of sprite spriteNum
  244.   set flegghino to suicciacast(spriteNum, SaveCast, castDown)
  245.   repeat while the stillDown
  246.     set flegghino to suicciacast(spriteNum, SaveCast, castDown, flegghino)
  247.   end repeat
  248.   puppetSprite(spriteNum, 0)
  249.   if flegghino = 1 then
  250.     do(handler)
  251.   end if
  252. end
  253.  
  254. on suicciacast spriteNum, SaveCast, castDown
  255.   if rollOver(spriteNum) then
  256.     set the castNum of sprite spriteNum to castDown
  257.     updateStage()
  258.     return 1
  259.   else
  260.     set the castNum of sprite spriteNum to SaveCast
  261.     updateStage()
  262.     return 0
  263.   end if
  264. end
  265.  
  266. on gherollero
  267.   set thismc to the mouseCast
  268.   if lastmc = thismc then
  269.     if getOne(hotcast, thismc) then
  270.       mousewithin(script thismc)
  271.     end if
  272.   end if
  273.   if lastmc <> thismc then
  274.     if getOne(hotcast, lastmc) then
  275.       mouseexit(script lastmc)
  276.     end if
  277.     if getOne(hotcast, thismc) then
  278.       mouseenter(script thismc)
  279.     end if
  280.     set lastmc to thismc
  281.   end if
  282. end
  283.  
  284. on idle
  285.   if the machineType = 256 then
  286.     do(currentNetHandler)
  287.   end if
  288.   gherollero()
  289. end
  290.  
  291. on resetall
  292.   set the castNum of sprite 26 to 190
  293.   set the castNum of sprite 27 to 191
  294.   set the castNum of sprite 28 to 192
  295.   set the castNum of sprite 29 to 193
  296. end
  297.